ga.core.goperators
Class ProbabilityOp

java.lang.Object
  extended by ga.core.goperators.ProbabilityOp
Direct Known Subclasses:
FurnLayoutMutationOp, OnePointCrossoverOp, RealMutationOp, SegmentCutCrossoverOp, SimpleObjectCrossoverOp, SimpleObjectMutationOp, SwapCrossoverOp

public abstract class ProbabilityOp
extends java.lang.Object

Abstract class for a probability operator.

Since:
11.08.2012
Author:
Stephan Dreyer

Field Summary
private  int pOperation
           
private  java.util.Random rnd
           
 
Constructor Summary
ProbabilityOp(int pOperation)
          Initializes the operator with the given probability.
 
Method Summary
 boolean doOperate()
          Calculates by internal probability and random number if the operator should operate.
 boolean doOperate(int probability)
          Calculates by given probability and random number if the operator should operate.
protected  java.util.Random getRandom()
          Getter for the random.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

pOperation

private final int pOperation

rnd

private final java.util.Random rnd
Constructor Detail

ProbabilityOp

public ProbabilityOp(int pOperation)
Initializes the operator with the given probability.

Parameters:
pOperation - The probability.
Since:
11.08.2012
Method Detail

doOperate

public boolean doOperate()
Calculates by internal probability and random number if the operator should operate.

Returns:
true if probability met.
Since:
11.08.2012

doOperate

public boolean doOperate(int probability)
Calculates by given probability and random number if the operator should operate.

Parameters:
probability - The probability.
Returns:
true if probability met.
Since:
11.08.2012

getRandom

protected java.util.Random getRandom()
Getter for the random.

Returns:
The random.
Since:
11.08.2012